import service from '@/utils/request'

// 文件上传
export const uploadFilesRequest = (cloudPictureCode, type, sessionId, uploadId, data) => {
    return service({
        method: 'post',
        headers: { 'Content-Type': 'multipart/form-data' },
        url: `/fileManage/uploadFile/${cloudPictureCode}/${type}/${sessionId}/${uploadId}`,
        data,
    })
}

// 文件上传(多 正式页面)
export const uploadCloudPictureDataFileRequest = (cloudPictureCode, uploadFileType, sessionId, uploadId, data) => {
    return service({
        method: 'post',
        headers: { 'Content-Type': 'multipart/form-data' },
        url: `/uploadCloudPictureDataFile/${cloudPictureCode}/${uploadFileType}/${sessionId}/${uploadId}`,
        data,
    })
}

// 文件上传(多 测试页面)
export const uploadCloudPictureTestDataFileRequest = (cloudPictureCode, fileCode, data) => {
    return service({
        method: 'post',
        headers: { 'Content-Type': 'multipart/form-data' },
        url: `/uploadCloudPictureTestDataFile/${cloudPictureCode}/${fileCode}`,
        data,
    })
}

// 脚本文件上传
export const uploadScriptFileRequest = (cloudPictureCode,data) => {
    return service({
        method: 'post',
        headers: { 'Content-Type': 'multipart/form-data' },
        url: `/fileManage/uploadScriptFile/${cloudPictureCode}`,
        data,
    })
}

// 删除脚本文件
export const deleteScriptFileRequest = data => {
    return service({
        method: 'post',
        url: `/fileManage/deleteScriptFile`,
        data,
    })
}

// 测试数据文件上传
export const uploadTestDataFileRequest = (cloudPictureCode,fileCode,data) => {
    return service({
        method: 'post',
        headers: { 'Content-Type': 'multipart/form-data' },
        url: `/fileManage/uploadTestDataFile/${cloudPictureCode}/${fileCode}`,
        data,
    })
}

// 预览测试数据
export const previewTestDataRequest = data => {
    return service({
        method: 'post',
        url: `/fileManage/previewTestData`,
        data,
    })
}

// 测试绘图
export const testDrawRequest = data => {
    return service({
        method: 'post',
        url: `/cloudPicture/testDraw`,
        data
    })
}


// 示例文件下载
export const downloadSampleRequest = (cloudPictureCode,type) => {
    return service({
        method: 'get',
        url: `/cloudPicture/downloadDemo/${cloudPictureCode}/${type}`,
    })
}

// 获取图表数据
export const getChartDataRequest = data => {
    return service({
        method: 'post',
        url: `/cloudPicture/getChartData`,
        data
    })
}


// 下载表格
export const downloadChartRequest = data => {
    return service({
        method: 'post',
        url: `/cloudPicture/downloadChart`,
        data,
        responseType: 'arraybuffer'
    })
}

// 获取个人数据文件列表
export const getPersonDataFileListRequest = data => {
    return service({
        method: 'post',
        url: `/cloudPicture/getPersonDataFileList`,
        data,
    })
}

//删除个人数据文件
export const deleteFileRequest = data => {
    return service({
        method: 'post',
        url: `/fileManage/deleteFile`,
        data,
    })
}

//预览文件
export const previewDataRequest = data => {
    return service({
        method: 'post',
        url: `/cloudPicture/previewData`,
        data,
    })
}

//文件重命名
export const renameFileRequest = data => {
    return service({
        method: 'post',
        url: `/cloudPicture/renameFile`,
        data,
    })
}


// 获取示例数据
export const loadDemoChartRequest = data => {
    return service({
        method: 'post',
        url: `/cloudPicture/loadDemoChart`,
        data
    })
}

// 提交绘图
export const submitDrawRequest = data => {
    return service({
        method: 'post',
        url: `/cloudPicture/submitDraw`,
        data
    })
}

// 保存绘图
export const saveDrawRecordRequest = data => {
    return service({
        method: 'post',
        url: `/cloudPicture/saveDrawRecord`,
        data
    })
}

// 查询提交绘图记录
export const getDrawRecordRequest = data => {
    return service({
        method: 'post',
        url: `/cloudPicture/getDrawRecord`,
        data
    })
}

//获取页面配置
export const getPageSettingRequest = data => {
    return service({
        method: 'post',
        url: `/cloudPicture/getPageSetting`,
        data
    })
}

//提交绘图任务
export const commitDrawTaskRequest = data => {
    return service({
        method: 'post',
        url: `/cloudPicture/commitDrawTask`,
        data
    })
}

//查询绘图任务记录
export const getDrawTaskRecordRequest = data => {
    return service({
        method: 'post',
        url: `/cloudPicture/getDrawTaskRecord`,
        data
    })
}

//删除绘图任务记录
export const deleteDrawTaskRecordRequest = (taskId,sessionId,pageCode) => {
    return service({
        method: 'post',
        url: `/cloudPicture/deleteDrawTaskRecord/${taskId}/${sessionId}/${pageCode}`,
    })
}

//查询当前页面绘图记录
export const getPageDrawRecordRequest = cloudPictureCode => {
    return service({
        method: 'post',
        url: `/cloudPicture/getPageDrawRecord/${cloudPictureCode}`,
    })
}

//下载任务结果
export const downloadDrawFileRequest = data => {
    return service({
        method: 'post',
        url: 'cloudPicture/downloadDrawFile',
        data,
        responseType: 'arraybuffer'
    })
}

//查询脚本信息
export const viewScriptContentRequest = data => {
    return service({
        method: 'post',
        url: 'cloudPicture/viewScriptContent',
        data,
    })
}

//下载脚本zip
export const downloadScriptRequest = data => {
    return service({
        method: 'post',
        url: 'cloudPicture/downloadScript',
        data,
        responseType: 'arraybuffer'
    })
}

//获取可以克隆的菜单列表
export const getCloneMenuListRequest = data => {
    return service({
        method: 'post',
        url: '/personCenter/getCloneMenuList',
        data,
    })
}

//获取可以克隆的新版菜单列表
export const getNewConfigCloneMenuListRequest = data => {
    return service({
        method: 'post',
        url: '/personCenter/getNewConfigCloneMenuList',
        data,
    })
}

//对比分组
export const compareGroupRequest = data => {
    return service({
        method: 'post',
        url: '/cloudPicture/compareGroup',
        data,
    })
}

//获取文件分组
export const getFileGroupRequest = data => {
    return service({
        method: 'post',
        url: '/cloudPicture/getFileGroup',
        data,
    })
}

//查询绘图类型列表
export const getDrawTypeListRequest = data => {
    return service({
        method: 'post',
        url: '/cloudPicture/getDrawTypeList',
        data,
    })
}

// 查询绘图工具列表
export const getDrawToolListRequest = data => {
    return service({
        method: 'post',
        url: '/cloudPicture/getDrawToolList',
        data,
    })
}

//图表说明上传
export const chartFileRequest = (cloudPictureCode,data) => {
    return service({
        method: 'post',
        headers: { 'Content-Type': 'multipart/form-data' },
        url: `/fileManage/uploadChartDescription/${cloudPictureCode}`,
        data,
    })
}

// 删除图表说明
export const delChartFileRequest = data => {
    return service({
        method: 'post',
        url: `/fileManage/deleteChartDescription`,
        data,
    })
}

//说明书上传
export const gifFileRequest = (cloudPictureCode,data) => {
    return service({
        method: 'post',
        headers: { 'Content-Type': 'multipart/form-data' },
        url: `/fileManage/uploadSpecification/${cloudPictureCode}`,
        data,
    })
}

// 删除说明书
export const delGifFileRequest = data => {
    return service({
        method: 'post',
        url: `/fileManage/deleteSpecification`,
        data,
    })
}

// 删除等待任务
export const deleteWaitingTaskRequest = data => {
    return service({
        method: 'post',
        url: `/cloudPicture/deleteWaitingTask`,
        data,
    })
}

// 上移等待任务
export const upWaitingTaskTaskRequest = data => {
    return service({
        method: 'post',
        url: `/cloudPicture/upWaitingTask`,
        data,
    })
}

// 修改任务备注
export const modifyTaskRemarkRequest = data => {
    return service({
        method: 'post',
        url: `/cloudPicture/modifyTaskRemark`,
        data,
    })
}

// 删除运行中任务
export const deleteRunTaskRequest = data => {
    return service({
        method: 'post',
        url: `/cloudPicture/deleteRunTask`,
        data,
    })
}

// 保存云工具配置(新)
export const saveCloudToolConfigRequest = data => {
    return service({
        method: 'post',
        url: `/cloudTool/saveCloudToolConfig`,
        data,
    })
}

// 查询云工具原始配置
export const searchCloudToolSourceConfigRequest = data => {
    return service({
        method: 'post',
        url: `/cloudTool/searchCloudToolSourceConfig`,
        data,
    })
}

// 加载云工具(页面)
export const loadCloudToolPageRequest = data => {
    return service({
        method: 'post',
        url: `/cloudTool/loadCloudToolPage`,
        data,
    })
}

// 提交云工具绘图任务
export const submitCloudToolDrawTaskRequest = data => {
    return service({
        method: 'post',
        url: `/cloudTool/submitCloudToolDrawTask`,
        data,
    })
}

// 测试云工具绘图
export const testCloudToolDrawRequest = data => {
    return service({
        method: 'post',
        url: `/cloudTool/testCloudToolDraw`,
        data,
    })
}

// 获取文件分组信息
export const getFileGroupInfoRequest = data => {
    return service({
        method: 'post',
        url: `/cloudTool/getFileGroupInfo`,
        data,
    })
}